﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script>

    const listen = (cb) => fetch('/listen')
        .then(r => r.text())
        .then(t => {
            cb(t)
            listen(cb)
        })

    listen((r) => console.log(r))

    const send = (m) => fetch('/send?m=' + encodeURIComponent(m))

</script>
</body>
</html>